function [blobsA, blobsB] = findHomologPoints2(blobsA, blobsB, band)
%FINDHOMOLOGPOINTS2 Find pairs of homologous point.
%   [blobsA, blobsB] = findHomologPoints2( blobsA, blobsB, band ) finds
%   pairs of homologous points, given by the centers of the sets of Blob
%   objects, blobsA and blobsB.
%   Normal stereo case is assumed.
%   
%  PARAMETERS
%   blobsA: First set of Blob objects.
%   blobsB: Second set of Blob objects.
%   band:   Width of the band (in pixel) which homologous points must lie within.

centersA(length(blobsA), 2) = 0;
centersB(length(blobsB), 2) = 0;
for i = 1:length(blobsA)
    centersA(i,:) = blobsA{i}.getCenter;
end
for i = 1:length(blobsB)
   centersB(i,:) = blobsB{i}.getCenter;
end


if length(centersA) == 0
    warning('findHomologPoints2: centersA is empty.');
end
if length(centersB) == 0
    warning('findHomologPoints2: centersB is empty.');
end

try
    %table = InterfaceMex('HomologPoints', centersA, centersB, band/2);
    table = locatorPose('HomologPoints', centersA, centersB, band/2);
catch
    error('findHomologPoints2: Could not find any homologous points!');
end

[rows, cols] = size(table);
for i = 1:rows
    blobsA{table(i,1)}.homologPoint = table(i,2);
    blobsB{table(i,2)}.homologPoint = table(i,1);
end
